package spring.annotation.case1.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Scope;

@Configuration
@ImportResource("classpath:config.xml")
public class StoreConfig {
    @Autowired
    private Store<String> s1;
    @Autowired
    private Store<Integer> s2;

    @Bean
    public Store<String> stringStore() {
        return new StringStore();
    }

    @Bean
    public Store<Integer> integerStore() {
        return new IntegerStore();
    }

    @Bean(name = "isString")
    public StringStore storeTest() {
        System.out.println("s1" + s1.getClass().getName());
        System.out.println("s2" + s2.getClass().getName());
        return new StringStore();

    }
}

/*@Bean
@Scope(value="prototype")
public Store getStringStore() {
	return new StringStore();
}*/
/*@Value("${url}")
	private String url;
	@Value("${jdbc.username}")
	private String username;
	@Value("${password}")
	private String password;
	@Bean(name="nnn")
	@Autowired
	public MyDriverManager myDriverManager(){
		return new MyDriverManager(url,username,password);
	}*/